<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="../../common/common-easyui.jspf" %>
<%@ include file="../../common/common-jstl.jspf" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <style type="text/css">
        p {
            text-align: center;
        }

        a {
            height: 30px;
            width: 99%;
        }

    </style>
</head>
<body class="easyui-layout">
<div data-options="region:'west',title:'系统菜单',hideCollapsedContent:false,split:true,width:'200px'">
    <div id="sysmenu" class="easyui-accordion" data-options="fit:true,">
        <c:forEach items="${mainMenuList }" var="mainMenu">
            <div title="${mainMenu.rightName }">
                <c:forEach items="${childMenuList }" var="childMenu">
                    <c:if test="${childMenu.parentId==mainMenu.rightId }">
                        <p><a class="easyui-linkbutton"
                              onclick="javascript:menuUrl('${childMenu.rightUrl }','${childMenu.rightName }')"
                              href="javascript:;">${childMenu.rightName }</a></p>
                    </c:if>
                </c:forEach>
            </div>
        </c:forEach>
    </div>
</div>
<div data-options="region:'north',height:'65px'">
    <h1 style="text-align: center;">考试管理系统</h1>
</div>
<div data-options="region:'south',height:'50px'"><p style="text-align: center;">&copy;YT8 second</p></div>
<div data-options="region:'center'">
    <div id="systabs" class="easyui-tabs" data-options="fit:true">
        <div title="首页">
            <h2>欢迎来到考试管理系统</h2>
        </div>
    </div>
</div>

<script type="text/javascript">
    function menuUrl(url, title) {
        // 判断如果选项卡已经打开直接选中，如果没有生成一个新选项卡
        var flag = $('#systabs').tabs('exists', title);

        if (flag) {
            $('#systabs').tabs('select', title);
        } else {
            $('#systabs').tabs('add', {
                title: title,
                closable: true,
                selected: true,
                content: '<iframe  frameborder="0" scrolling="true" src="' + url + '" style="width:100%;height:100%;position:relative;"></iframe>',
                tools: [{
                    iconCls: 'icon-reload',
                    handler: function () {
                        //刷新选项卡
                        $('.tabs-panels > .panel:visible > .panel-body > iframe').get(0).contentDocument.location.reload(true);
                    }
                }]
            });
        }
    }


</script>
</body>
</html>